package util;

import android.app.ActivityManager;
import android.content.Context;
import android.os.Process;


import java.util.List;

public class XiaomiPushUtils {

    // user your appid the key.
    private static final String APP_ID = "2882303761519863784";
    // user your appid the key.
    private static final String APP_KEY = "5751986336784";
    //你的包名
    public static final String TAG = "com.xiekun.myapplication";

    public static void registerPushXiaomi(Context context){
        if (shouldInit(context)) {

        }

    }


    private static boolean shouldInit(Context context) {
        ActivityManager am = ((ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE));
        List<ActivityManager.RunningAppProcessInfo> processInfos = am.getRunningAppProcesses();
        String mainProcessName = context.getPackageName();
        int myPid = Process.myPid();
        for (ActivityManager.RunningAppProcessInfo info : processInfos) {
            if (info.pid == myPid && mainProcessName.equals(info.processName)) {
                return true;
            }
        }
        return false;
    }

}
